< previous page page_65 next page >

Page 65
0065-01.jpg
Figure 4.4
The 
Alignment, Appearance, and BorderStyle
properties can change the look of a label control.
note.gif The Alignment property also affects the text when the label is used to display multiple lines. The control aligns each line according to the setting of the Alignment property (refer to Figure 4.4). square.gif

Entering Text with a Text Box
Because much of what programs do is to retrieve, process, and display text, you might guess (and you would be correct) that the major workhorse of many programs is the TextBox control. The text box allows you to display text; more important, however, it also provides an easy way for your users to enter and edit text and for your program to retrieve the information that was entered.
Handling Multiple Lines of Text
In most cases, you use the text box to handle a single piece of information, such as a name or address. But the text box can handle thousands of characters of text. A TextBox control's contents are stored in its Text propertythe main property with which your programs interact. You can also limit the number of characters users can enter by using the MaxLength property.
By default, the text box is set up to handle a single line of information. This amount of information is adequate for most purposes, but occasionally your program needs to handle a larger amount of text. The text box has two properties that are useful for handling larger amounts of text: the MultiLine and ScrollBar properties.
The MultiLine property determines whether the information in a text box is displayed on a single line or wraps and scrolls to multiple lines. If the MultiLine property is set to True, information is displayed on multiple lines, and word wrapping is handled automatically. Users can press Enter to force a new line. The ScrollBar property determines whether scrollbars are displayed in a text box, and if so, what types of scrollbars (None, Horizontal, Vertical, or Both). The scrollbars are useful if more text is stored in the Text property than fits in the text box. The ScrollBar property has an effect on the text box only if its MultiLine property is set to True. Figure 4.5 shows the effects of the MultiLine and ScrollBar properties.

 
< previous page page_65 next page >